<?php

use yii\helpers\Html;
use yii\helpers\Url;

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = Yii::t('common', 'Posts') . ' - ' . Yii::$app->params['site_name'];
$this->params['breadcrumbs'][] = Yii::t('common', 'Posts');
?>
<div class="subject-index row">
    <div class="col-md-8 br10 white">
        <h1 class="sky"><i class="iconfont">&#xe606;</i>熱門主題</h1>
        <hr>
        <?php
        foreach ($model as $k => $item) {
        if ($k%6 == 0) {
        echo "<div class='imagetext row'>";
            }
            echo '<div class="imagetext1 col-xs-6 col-sm-4 col-md-2">';
                echo "<p class='img'><a href=" . Url::toRoute('/subject/' . $item['id']) . "><img src=" . Yii::$app->params['img_domain'].$item['img'] . " alt=" . $item['title'] . " /></a></p>";
                echo "<h4><a href=" . Url::toRoute('/subject/' . $item['id']) . ">" . $item['title'] . "</a></h4>";
                echo '</div>';

            if ($k!=0 & $k%6 == 5) {
            echo "</div><div class='pb15'></div>";
        }
        if ($k!=5 & $k == (count($model) - 1)) {
        echo "</div><div class='pb15'></div>";
    }
    }
    ?>
</div>
<div class="col-md-4 br10 white">
    <div class="row widget">
        <div class="col-md-12">
            <h2 class="widget_title"><small><i class="iconfont">&#xe647;</i>热门推荐</small></h2>
            <hr>
            <?php
            foreach ($hot as $value) {
                echo '<p class="article"><i class="iconfont fs20">&#xe89d;</i>';
                echo Html::a($value['title'], Url::to('/topic/' . $value['id']));
                echo '</p>';
            }
            ?>
        </div>
    </div>
    <div class="row widget">
        <div class="col-md-12">
            <h2 class="widget_title"><small><i class="iconfont">&#xe60d;</i>标签聚合</small></h2>
            <hr>
            <?php
//            foreach ($tag as $value) {
//                echo '<span class="widget-tag">';
//                echo Html::a($value['tag'], Url::to('/topic/' . $value['tag']), ['title' => $value['tag'], 'class' => 'btn btn-default', 'role' => 'button']);
//                echo '</span>';
//            }
            ?>
        </div>
    </div>        
</div>
</div>
